fontchooser: Make changing the preview text fast
authorBenjamin Otte <otte@redhat.com>
Tue, 20 Sep 2011 14:49:49 +0000 (16:49 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 22 Sep 2011 19:44:04 +0000 (21:44 +0200)
Instead of reloading the font list, we now just queue a redraw. This
works, because the preview text is added using a cell data func instead
of a custom column.

gtk/gtkfontchooserwidget.c

index f4789d7619981caa5943157b08aecd62a25a59d5..6257e6d3eec36239682182236b47c0b8da614d8a 100644 (file)
@@ -1036,16 +1036,18 @@ static void
 gtk_font_chooser_widget_set_preview_text (GtkFontChooserWidget *fontchooser,
                                           const gchar          *text)
 {
-  g_free (fontchooser->priv->preview_text);
-  fontchooser->priv->preview_text = g_strdup (text);
+  GtkFontChooserWidgetPrivate *priv = fontchooser->priv;
 
-  populate_list (fontchooser,
-                 GTK_TREE_VIEW (fontchooser->priv->family_face_list),
-                 fontchooser->priv->model);
+  g_free (priv->preview_text);
+  priv->preview_text = g_strdup (text);
 
-  gtk_entry_set_text (GTK_ENTRY (fontchooser->priv->preview), text);
+  gtk_entry_set_text (GTK_ENTRY (priv->preview), text);
 
   g_object_notify (G_OBJECT (fontchooser), "preview-text");
+
+  /* XXX: There's no API to tell the treeview that a column has changed,
+   * so we just */
+  gtk_widget_queue_draw (priv->family_face_list);
 }
 
 static gboolean